{extend name='base'}
{block name='content'}
<div class="m-b-md">
    <h2 class="m-b-none">类型管理</h2>
</div>
<div class="row">
    <div class="col-sm-12">
        <section class="panel panel-default">
            <div class="panel-body">
                <table class="table table-hover">
                    <thead>
                    <tr>
                        <th>类型编号</th>
                        <th>类型名称</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {foreach name="data" item="v"}
                    <tr>
                        <td>{$v['tid']}</td>
                        <td>{$v['tname']}</td>
                        <td>
                            <div class="btn-group">
                                <a href="{:url('typeAttr/index',['tid'=>$v['tid']])}" class="btn btn-primary">类型属性</a>
                                <a href="{:url('add',['tid'=>$v['tid']])}" class="btn btn-info">编辑</a>
                                <a href="javascript:;" onblur="del({$v['tid']})" class="btn btn-danger">删除</a>
                            </div>
                        </td>
                    </tr>
                    {/foreach}
                    </tbody>
                </table>
            </div>
        </section>
    </div>
</div>
<div class="btn-group">
    <a href="{:url('admin/type/add')}" class="btn btn-success">类型添加</a>
</div>
<script>
    function del(tid) {
        var obj = util.modal({
            title:'确认删除吗?',//标题

            content:'',//内容

            footer:'<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button><button type="button" class="btn btn-danger confirm" data-dismiss="modal">删除</button>',//底部

            width:600,//宽度

            events:{
                confirm:function(){
                    //哪个元素上有.confirm类，被点击就执行这个回调
                    location.href = "{:url('del')}" + '?tid=' + tid;
                }
            }
        });
        //显示模态框
        obj.modal('show');
    }
</script>
{/block}